home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Viewers / ACRViewer.1.3 / developer / api / examples / Conversion.m < prev    next >
Encoding:
Text File  |  1995-05-12  |  979 b   |  41 lines

  1. // This is example source code. It demonstrates the use of the ACRViewer API.
  2. // 
  3. // Jens Breitenborn, 95/05/03
  4.  
  5. #import "ACRViewer.h"
  6. #import <sys/param.h>
  7.  
  8. // All files specified in the command line are converted to TIFF files.
  9. // The created TIFF files will be stored in the current directory.
  10.  
  11. main(int argc, char *argv[])
  12. {
  13. int i;
  14. id acrviewer= [[ACRViewer alloc] init]; 
  15. char outfilename[MAXPATHLEN+1];
  16.  
  17.     if (argc == 1){
  18.         puts("usage:acr2tiff file-list");
  19.         exit(1);
  20.     }
  21.  
  22.     if (!acrviewer) {
  23.         puts("Could not get API for ACRViewer!\n"
  24.              "Probably ACRViewer isn't placed in the\n"
  25.              "WorkspaceManagers' search path.\n");
  26.         exit(1);
  27.     }
  28.     
  29.     for (i= 1; i < argc; i++){
  30.         if (strrchr(argv[i],'/')) 
  31.             sprintf(outfilename,"%s.tiff",strrchr(argv[i],'/')+1);
  32.         else
  33.             sprintf(outfilename,"%s.tiff",argv[i]);
  34.  
  35.         printf("Converting %s to TIFF ...",argv[i]); fflush(stdout);
  36.         if ([acrviewer convertACRFile:argv[i] toTiff: outfilename])
  37.         puts("OK"); else puts("ERROR.");
  38.     }
  39.     
  40. }
  41.